﻿using System;

using Sunyi.Project.WebPoint.BusinessLogic;
using Sunyi.Project.WebPoint.WebControl;

namespace ActivitySystem.Web.Admin
{
    public partial class PageList : WebPointPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    BindPage();
                }
                catch (Exception ex)
                {
                    ExceptionHandler.Handle(this, ex);
                }
            }
        }

        private void BindPage()
        {
            PageManager pageManager = new PageManager();
            gvPages.DataSource = pageManager.SelectAll();
            gvPages.DataBind();

            if (!Page.IsPostBack)
            {
                AuditLogger.Write(AuditLogOperationCode.Search, this.GetType().Name);
            }
        }

        #region WebPointPage Member

        protected override void ApplyPermission()
        {
            if (!this.HasPermission(PermissionType.Update))
            {
                if (gvPages.Columns.Count >= 1) gvPages.Columns[gvPages.Columns.Count - 1].Visible = false;
            }
        }

        #endregion
    }
}